<?php 

if (!empty($_POST)) die;

$account_addr = dt_query_one("SELECT * FROM account_addr WHERE id = ".$auth['id']);
if (!$account_addr) {
	$rs = dt_query("INSERT INTO account_addr (id) VALUES (".$auth['id'].")");
	if (!$rs) die('新建account_addr数据失败！^_^');
}

?>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-8 column" style="border-right: 1px solid #ddd">
			<div class="account-well">
				<div class="alert alert-info">
					<b>提示</b>
					<ol>
						<li>收货地址只有您自己和发货方可见。</li>
						<li>其他任何人无权查看。</li>
					</ol>
				</div>
				<form class="form-horizontal" action="javascript:do_account_addr_set()" id="do_account_addr_set">
					<br>
					<div class="row clearfix">
						<div class="col-md-9 column">
							<input type="text" class="form-control" name="addr" required="" value="<?php echo $account_addr['addr'] ?>"/>
						</div>
						<div class="col-md-3 column">
							<label class="control-label">收货地址</label>
						</div>
					</div>
					<br>
					<div class="row clearfix">
						<div class="col-md-5 column">
							<input type="text" class="form-control" name="p_code" required="" value="<?php echo $account_addr['p_code'] ?>"/>
						</div>
						<div class="col-md-3 column">
							<label class="control-label">邮政编码</label>
						</div>
					</div>
					<br>
					<div class="row clearfix">
						<div class="col-md-5 column">
							<input type="text" class="form-control" name="name" required="" value="<?php echo $account_addr['name'] ?>"/>
						</div>
						<div class="col-md-3 column">
							<label class="control-label">收件人</label>
						</div>
					</div>
					<br>
					<div class="row clearfix">
						<div class="col-md-5 column">
							<input type="text" class="form-control" name="phone" required="" value="<?php echo $account_addr['phone'] ?>"/>
						</div>
						<div class="col-md-3 column">
							<label class="control-label">联系电话</label>
						</div>
					</div>
					<hr>
					<!-- token -->
					<input type="hidden" name="token" value="<?php echo get_token() ?>"/>
					<div class="row clearfix">
						<div class="col-md-3 column">
							<button type="submit" class="btn btn-primary btn-block">保存</button>
						</div>
						<div class="col-md-5 column">
						</div>
					</div>
				</form>
			</div>
		</div>
		<div class="col-md-4 column">
			<?php require_once('inc/account_pub_sidebar.phtml') ?>	
		</div>
	</div>
</div>
<script type="text/javascript">

$(document).ready(function(){
	$('li#account_addr_set').addClass('active');
});

</script>
